package GameObjects.Instances;

import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;

import Helper.HelperMethods;

public class Instance 
{
	public final BufferedImage IMAGE;
	public final int WIDTH;
	public final int HEIGHT;
	public final Shape BOUNDS;
	
	public Instance(BufferedImage image, int width, int height, Shape bounds)
	{
		this.IMAGE = image;
		this.WIDTH = width;
		this.HEIGHT = height;
		this.BOUNDS = bounds;
	}
	
	public Shape transformBounds(double x, double y, double theta)
	{
		Shape transBounds;
		AffineTransform aff = new AffineTransform();
		aff.translate(x - WIDTH/2, y - HEIGHT/2);
		transBounds = aff.createTransformedShape(BOUNDS);
		aff = new AffineTransform();
		double radian = HelperMethods.degreesToRadians(theta);
		aff.rotate(radian, x, y);
		transBounds = aff.createTransformedShape(transBounds);
		return transBounds;
	}
}
